<template>
  <view>
    <view class="container">
      <view class="input-box">
        <u-input focus="true" maxlength="4" v-model="userInfo.nickname" @change="changeNickName">
          <u--text text="昵称: " slot="prefix" margin="0 3px 0 0" type="text"></u--text>
        </u-input>
      </view>

      <view class="btn">
        <u-button type="success" text="确定" @click="backButton"></u-button>
      </view>
    </view>
  </view>
</template>

<script>
  import {
    mapState,
    mapMutations
  } from 'vuex'
  export default {
    data() {
      return {

      };
    },
    computed: {
      ...mapState('user', ['userInfo'])
    },
    methods: {
      ...mapMutations('user', ['changeNickName', 'backButton'])
    }
  }
</script>

<style lang="scss" scoped>
  .container {
    width: 90%;
    margin: 0 auto;
    margin-top: 20rpx;

    .btn {
      margin: 0 auto;
      margin-top: 500rpx;
      width: 300rpx;
    }
  }
</style>
